import { useState } from 'react';

export default function Demo() {
    const [shouldCrash, setShouldCrash] = useState(false);

    const handleCrash = () => {
        setShouldCrash(true);
    };

    // 触发渲染错误，导致白屏
    if (shouldCrash) {
        const undefinedObj = undefined;
        return <div>{undefinedObj.nonExistentProperty.toString()}</div>;
    }

    return (
        <div>
            <div>Demo</div>
            <button onClick={handleCrash}>崩溃程序</button>
        </div>
    )
}

